#include <iostream>
using namespace std;

char week[] = {
    'a', 'b', 'c', 'd', 'e', 'f', 'g',
    'h', 'i', 'j', 'k', 'l', 'm', 'n',
    'o', 'p', 'q', 'r', 's', 't', 'u',
    'v', 'w', 'x', 'y', 'z'};

typedef long long ll;
typedef struct
{
    ll day;
    ll month;
    ll week;
} Setting;
typedef struct
{
    ll year;
    ll month;
    ll day;
} Date;

int main()
{
    Setting set;
    Date date;
    ll days; //所有的天数
    int Week;
    cin >> set.day >> set.month >> set.week;
    cin >> date.day >> date.month >> date.year;
    days = (date.year - 1) * set.month * set.day;      //计算整年天数
    days += ((set.day) * (date.month - 1)) + date.day; //计算非整年天数
    Week = (days % set.week + set.week) % set.week;
    if (Week == 0)
    {
        Week = set.week; //坑 当星期标识为0时，证明与当前最高星期数重合
    }
    //printf("%d", Week);
    printf("%c", week[Week - 1]);
}